﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>


//例一
struct s0
{
	char c1;
	int i;
	char c2;
};

struct s2
{
	char c;
	struct s0 s;
	double d;
};

int main()
{
	printf("struct s2的大小 : %zd\n", sizeof(struct s2));
	return 0;
}


//例二
#pragma pack(1)//设置默认对⻬数为1
struct s0
{
	char c1;
	int i;
	char c2;
};
#pragma pack()//取消设置的对⻬数，还原为默认

struct s1
{
	char c1;
	int i;
	char c2;
	double j;
};

int main()
{
	printf("struct s0的大小 : %zd\n", sizeof(struct s0));
	printf("struct s1的大小 : %zd\n", sizeof(struct s1));
	return 0;
}